package com.cw.mapper2;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cw.dto.InpatientRegistrationCondition;
import com.cw.dto.LeaveAdviceDTO;
import com.cw.dto.PreoperationDTO;
import com.cw.dto.ReleaseJGBedHistoryDTO;
import com.cw.entity.*;
import com.cw.request.DataSourceRequest;
import com.cw.request.EemptyPatientRequest;
import com.cw.request.NoCheckBedRequest;
import com.cw.response.DataSourceResponse;
import com.cw.vo.LeaveAdviceVO;
import com.cw.vo.MedicalGroupVO;
import com.cw.vo.PreoperationListVO;
import com.cw.vo.ReadmissionDaysVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 住院预约表 Mapper 接口
 * </p>
 *
 * @author smq
 * @since 2021-05-06
 */
@Repository
public interface ThisIiPrepayinMapper extends BaseMapper<ThisIiPrepayin> {
    /**
     * 列表
     * @param condition 查询条件
     * @author ly
     * @date 2021/5/6 10:01
     * @return java.util.List<com.cw.entity.ThisIiPrepayin>
     */
    List<ThisIiPrepayin> getThisIiPrepayins(InpatientRegistrationCondition condition);

    /**
     * 住院预约记录
     * @param condition 查询条件
     * @author ly
     * @date 2021/5/20 9:50
     * @return java.util.List<com.cw.entity.ThisIiPrepayin>
     */
    List<ThisIiPrepayin> getTheInpatientOfficeHasBeenProcessed(InpatientRegistrationCondition condition);

    /**
     * 出院列表
     * @param condition 查询条件
     * @return java.Util.Map<java.lang.String,java.lang.Object>
     * @author ly
     * @date 2021/07/13 11:04
     */
    @Deprecated
    List<ThisIiPrepayin> getDischargeList(InpatientRegistrationCondition condition);

    /**
     * 获取历史记录列表
     * @param condition 查询条件
     * @return java.util.List<com.cw.entity.ThisIiPrepayin>
     * @author ly
     * @date 2021/07/19 14:30
     */
    List<ThisIiPrepayin> getHistoryRecordList(InpatientRegistrationCondition condition);

    /**
     * 获取没有床位的患者信息
     *
     * @param eemptyPatientRequest
     * @return
     */
//    List<ThisIiPrepayin> getEemptyPatientList(EemptyPatientRequest eemptyPatientRequest);

    List<ThisIiPrepayin> getEemptyPatientListNew(EemptyPatientRequest eemptyPatientRequest);

    List<DataSourceResponse> getDataSource(DataSourceRequest dataSourceRequest);

    List<EmptyBedReport> getEmptyBedReport(DataSourceRequest dataSourceRequest);


    /**
     * 手工录入插入电子病历表
     * @param thisIiPrepayin 插入信息
     * @author ly
     * @date 2021/5/17 18:31
     * @return boolean
     */
    boolean insertThisIiPrepayin(ThisIiPrepayin thisIiPrepayin);

    /**
     * 获取电子住证表最小PreId
     * @author cww
     * @date 2021/09/14 18:31
     * @return BigDecimal
     */
    List<ThisIiPrepayin> getMinPreId();

    /**
     * 调用附二院存储过程修改病床集管属性
     * @param resultMap 录入信息对象
     * @author cww
     * @date 2021/09/28 9:44
     * @return java.util.Map<String,String>
     */
    Map<String,String> chageBedType(Map<String, Object> resultMap);

    void updateBedNo(List<BigDecimal> lstPreid);

    /**
     * 获得非集管校验
     *parm：INPATIENT_NO  住院证号
     */
    List<ThisIiInmaininfo> getbedCheck(NoCheckBedRequest inpatientNo);

    ThisIiPrepayin getReleaseBedHistoryInfo(ReleaseJGBedHistoryDTO releaseJGBedHistoryDTO);

    ThisIiPrepayin selectPatientInfoByIdenno(String idenno);

    List<ThisIiPrepayin> selectByIdList(@Param("list") List<PatientBedMiddleRjbf> appointList);

    ThisIiPrepayin queryPersonalinformation(String idenno);

    /**
     * 出院医嘱查询
     * @param dto
     * @return
     */
    //11-27
    List<LeaveAdviceVO> leaveAdvicePage(@Param("leaveDTO") LeaveAdviceDTO dto);

    /**
     * 出院医嘱查询今日出院跟明日出院的患者
     * @param  inpatientNoList
     * @return
     */
    //11-27
    List<LeaveAdviceVO> leaveAdviceInpatientNoList(List<String> inpatientNoList);


    /**
     * 出院医嘱查询
     * @param patientNo
     * @return
     */
    //11-27
    LeaveAdviceVO leaveAdviceGetOne(String patientNo);

    /**
     * 预手术编码查询
     * @param dto
     * @return
     */
    List<PreoperationListVO> preoperation(@Param("preDTO") PreoperationDTO dto);

    /**
     *获取专业组信息
     * @return
     */
    List<MedicalGroupVO> getmedicalGroup(@Param("deptCode") String deptCode);

    /**
     * 获取医疗组组长
     *
     * @param medicalGroupCode
     * @param deptCode
     * @return
     */
    List<MedicalGroupVO> getmedicalGroupLeader(@Param("medicalGroupCode")String medicalGroupCode,@Param("deptCode") String deptCode);

    /**
     * 获取上一次出院时间与这次开立住院证的时间差
     *
     *
     * @param idenNo
     * @return
     */
    List<ReadmissionDaysVO> getReadmissionDays(@Param("idenNo") String idenNo,@Param("date") Date date);
}
